from django.db import models

# Create your models here.
from account.models import MyUser
from article.models import BaseModel


class AlbumInfo(BaseModel):
    #设置自增长加主键
    id=models.AutoField(primary_key=True)
    #设置表关联 一对多
    user=models.ForeignKey(MyUser,on_delete=models.CASCADE,
                           verbose_name='用户')
    title=models.CharField('标题',max_length=50,blank=True)
    introduce=models.CharField('描述',max_length=200,blank=True)
    photo=models.ImageField('图片',blank=True,upload_to='images/album')
    def __str__(self):
        return str(self.id)
    class Meta:
        ordering = ['-update_time', '-id']  # 排序
        verbose_name='图片墙管理'
        verbose_name_plural='图片墙管理'